<template>
  <el-menu class="el-menu-vertical-demo" :default-active="$route.path" router>
    <el-submenu v-for="(route, index) in navs" :key="index" :index="index + ''">
      <template slot="title">
        <span>{{route.name}}</span>
      </template>
      <el-menu-item-group>
        <el-menu-item v-for="(c, index) in route.children" :key="index" :index="route.path + '/' + c.path"><i class="iconfont icon-user-point"></i>{{c.name}}</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: '',
  data () {
    return {
      navs: []
    }
  },
  created () {
    this.navs = this.$router.options.routes
  }
}
</script>
<style lang="less">
@height:100%;
.el-menu{
  height: @height;
  background-color: #f9f9f9;
  .el-menu-item-group{
    background-color: #fff;
  }
}
</style>
